<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>导入用户数据</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            color: #333;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            color: #666;
        }
        input[type="file"] {
            margin-top: 5px;
        }
        button, a.button {
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            margin-right: 10px;
        }
        .btn-upload {
            background-color: #4CAF50;
            color: white;
        }
        .btn-back {
            background-color: #f1f1f1;
            color: #333;
        }
        .flash {
            padding: 10px;
            margin-bottom: 15px;
            border-radius: 4px;
        }
        .flash.success {
            background-color: #dff0d8;
            color: #3c763d;
        }
        .flash.error {
            background-color: #f2dede;
            color: #a94442;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>导入数据到用户: {{ user.username }}</h1>

        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="flash {{ category }}">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        <form method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label for="zip_file">选择ZIP文件</label>
                <input type="file" id="zip_file" name="zip_file" accept=".zip" required>
                <p>请选择包含用户数据的ZIP文件。导入后将覆盖该用户的所有现有数据。</p>
            </div>
            <button type="submit" class="btn-upload">上传并导入</button>
            <a href="{{ url_for('admin_dashboard') }}" class="button btn-back">返回</a>
        </form>
    </div>
</body>
</html>